﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Akso.Infrastructure.Data.Annotations
{
    /// <summary>
    /// The DecimalPrecision class allows us to decorate our Entity Models with a Precision attribute 
    /// to specify decimal precision values for the database column
    /// </summary>
    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
    public class DecimalPrecisionAttribute : Attribute
    {
        /// <summary>
        /// The total number of digits to store, including decimals
        /// </summary>
        public byte Precision { get; set; }
        /// <summary>
        /// The number of digits from the precision to be used for decimals
        /// </summary>
        public byte Scale { get; set; }

        /// <summary>
        /// Define the precision and scale of a decimal data type
        /// </summary>
        /// <param name="precision">The total number of digits to store, including decimals</param>
        /// <param name="scale">The number of digits from the precision to be used for decimals</param>
        public DecimalPrecisionAttribute(byte precision, byte scale)
        {
            Precision = precision;
            Scale = scale;
        }
    }
}
